package com.eastday.model;
import java.util.Map;
import java.util.HashMap;
import java.util.List;

import org.jdom.Document;
import org.jdom.Element;

/**
 * 
 * @author dingxs
 *
 */
public class UrlConfigModel {

	private Map<String,String[]> urlConfigMap;
	
	public UrlConfigModel(){
		urlConfigMap = new HashMap<String,String[]>();
	}

	public void setUrlConfigMap(Map<String, String[]> urlConfigMap) {
		this.urlConfigMap = urlConfigMap;
	}

	public Map<String, String[]> getUrlConfigMap() {
		return urlConfigMap;
	}
	
	public void buildUrlConfig(Document document){
		Element root = document.getRootElement();
		List<Element> urlNodeList = root.getChildren("url");
		for(int i = 0;i<urlNodeList.size();i++)
		{
			Element urlNode      = urlNodeList.get(i);
			Element channelNode  = urlNode.getChild("channel");//Ƶ��
			Element filenameNode = urlNode.getChild("filename");//��ʱ�ļ���
			Element prefixNode   = urlNode.getChild("prefix");//t��ǰ׺
			String url           = urlNode.getAttributeValue("value");//url
			String[] urlInfo     = new String[3];
			urlInfo[0]           = channelNode.getText();
			urlInfo[1]           = filenameNode.getText();
			urlInfo[2]           = prefixNode.getText();
			urlConfigMap.put(url, urlInfo);
		}
	}
	
	
 }
